********************************* Figure 1 *******************************

use "/Data/2010_CHES_data_append.dta"
gen lrecon_01=lrecon/10
gen galtan_01=galtan/10
gen lrgen_01=lrgen/10
*Opposition EU integration
gen position_01=(position-1)/6
replace position_01=(position_01*-1)+1
colorscatter lrecon_01 galtan_01 position_01, rgb_low(20 20 20) rgb_high(225 225 225)
pwcorr lrecon_01 galtan_01 position_01, sig

********************************* Table 1 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
tab groupabbv_num_sort vote_DEPENDENT if Votetype_4==1, row nof


********************************* Figure 2 *******************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
*Rejecting proposals
quietly xtmelogit vote_reject c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
quietly margins, dydx(cultural_right_std economic_left_std) over(groupabbv_num_sort)
mplotoffset, offset(0.25) recast(scatter) name(Model2_1, replace) horizontal
*Abstaining being absent
quietly xtmelogit vote_abstain c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
quietly margins, dydx(cultural_right_std economic_left_std) over(groupabbv_num_sort)
mplotoffset, offset(0.25) recast(scatter) name(Model2_3, replace) horizontal

********************************* Figure 3 *******************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
*Rejecting proposals
quietly xtmelogit vote_reject c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort c.opposition_EUintegration_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
quietly margins, dydx(cultural_right_std economic_left_std opposition_EUintegration_std) over(groupabbv_num_sort)
mplotoffset, offset(0.25) recast(scatter) name(Model2_2, replace) horizontal
*Abstaining being absent
quietly xtmelogit vote_abstain c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort c.opposition_EUintegration_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
quietly margins, dydx(cultural_right_std economic_left_std opposition_EUintegration_std) over(groupabbv_num_sort)
mplotoffset, offset(0.25) recast(scatter) name(Model2_4, replace) horizontal


********************************* Figure 4 *******************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
******* Analysis for each of the policy areas on REJECTING
*Civil liberties
logit vote_reject c.civlib_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Civil liberties, justice & home affairs"
quietly margins, dydx(opposition_EUintegration_std) at(civlib_salience=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(Model3_1, replace)
*Environmental issues
logit vote_reject c.enviro_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Environment & public health"
quietly margins, dydx(opposition_EUintegration_std) at(enviro_salience=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(Model3_2, replace)

******* Analysis for each of the policy areas on ABSTAINING
*Civil liberties
quietly logit vote_abstain c.civlib_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Civil liberties, justice & home affairs"
quietly margins, dydx(opposition_EUintegration_std) at(civlib_salience=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(Model3_3, replace)
*Environmental issues
quietly logit vote_abstain  c.enviro_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Environment & public health"
quietly margins, dydx(opposition_EUintegration_std) at(enviro_salience=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(Model3_4, replace)




**************************************************************************
********************************* APPENDIX *******************************
**************************************************************************
********************************* Table 2 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
sum vote_reject vote_abstain position galtan lrecon if Votetype_4==1

********************************* Table 3 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
tab groupabbv_num_sort if Votetype_4==1, sum(cultural_right_std)
tab groupabbv_num_sort if Votetype_4==1, sum(economic_left_std)
tab groupabbv_num_sort if Votetype_4==1, sum(opposition_EUintegration_std)

********************************* Table 4 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
*Model 1
xtmelogit vote_reject c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
*Model 2
xtmelogit vote_reject c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort c.opposition_EUintegration_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
*Model 3
xtmelogit vote_abstain c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var
*Model 4
xtmelogit vote_abstain c.cultural_right_std##i.groupabbv_num_sort c.economic_left_std##i.groupabbv_num_sort c.opposition_EUintegration_std##i.groupabbv_num_sort if Votetype_4==1 || policyarea_num:, var

********************************* Table 5 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
*Model 1
logit vote_reject c.civlib_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Civil liberties, justice & home affairs"
*Model 2
logit vote_abstain c.civlib_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Civil liberties, justice & home affairs"
*Model 3
logit vote_reject c.enviro_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Environment & public health"
*Model 4
logit vote_abstain  c.enviro_salience##c.opposition_EUintegration_std i.groupabbv_num_sort cultural_right_std economic_left_std if Votetype_4==1 & policyarea=="Environment & public health"

********************************* Figure 5 ********************************
use "/Data/Roll call votes 7th EP 2009-2014.dta"
**************** Predicting rejecting legislation ****************
xtmelogit vote_reject c.cultural_right_std##i.policyarea_num c.economic_left_std##i.policyarea_num c.opposition_EUintegration_std##i.policyarea_num i.groupabbv_num i.CHES_country_num if Votetype_4==1 || policyarea_num:, var
estimates store xtmelogit_reject
estimates save "xtmelogit_reject - xtmelogit vote_reject, Votetype_1 & group=policyarea_num"
margins, dydx(cultural_right_std economic_left_std opposition_EUintegration_std) over(policyarea_num)
mplotoffset, offset(0.25) recast(scatter) name(margins_reject, replace) horizontal

**************** Predicting abstaining from legislative votes ****************
xtmelogit vote_abstain c.cultural_right_std##i.policyarea_num c.economic_left_std##i.policyarea_num c.opposition_EUintegration_std##i.policyarea_num i.groupabbv_num i.CHES_country_num if Votetype_4==1 || policyarea_num:, var
estimates store xtmelogit_abstain
estimates save "xtmelogit_abstain - xtmelogit vote_abstain, Votetype_1 & group=policyarea_num"
margins, dydx(cultural_right_std economic_left_std opposition_EUintegration_std) over(policyarea_num)
mplotoffset, offset(0.25) recast(scatter) name(margins_abstain, replace) horizontal

